package com.fubowen.lepton.db.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.fubowen.lepton.db.bean.Suggest
import kotlinx.coroutines.flow.Flow

@Dao
interface SuggestDao {

    @Query("select * from Suggest")
    fun all(): Flow<List<Suggest>>

    @Query("select * from Suggest where Id = :id")
    fun get(id: Int): Suggest?

    @Insert
    fun set(bean: Suggest)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun setOrIgnore(bean: Suggest): Long

    @Update
    fun put(bean: Suggest)

    @Delete
    fun del(bean: Suggest)

    @Query("DELETE FROM Suggest")
    fun clear()
}